package com.sixiaojie.flink.domain;

import lombok.Data;
import lombok.NoArgsConstructor;

import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.UniqueConstraint;
import java.util.Date;

@Data
@Entity
@Table(uniqueConstraints = {
        @UniqueConstraint(columnNames = {"userId", "date"})
})
@NoArgsConstructor
public class UserBehaviorSummary {
    /** 用户ID */
    @Id
    private Long userId;

    /** 日期 */
    private String date;

    /** 点击次数 */
    private Integer clickCount;

    /** 浏览次数 */
    private Integer viewCount;

    /** 搜索次数 */
    private Integer searchCount;

    /** 加购次数 */
    private Integer cartAddCount;

    /** 购买次数 */
    private Integer purchaseCount;

    /** 最后更新时间 */
    private Date lastUpdated = new Date();

    public UserBehaviorSummary(Long id, String dateStr) {
        this.userId = id;
        this.date = dateStr;
        this.clickCount = 0;
        this.viewCount = 0;
        this.searchCount = 0;
        this.cartAddCount = 0;
        this.purchaseCount = 0;
    }

}